<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<c:set var="pagePath" value="${pageContext.request.contextPath}" />
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>商品管理</title>
<link type="text/css" rel="stylesheet" href="${pagePath}/page/static/admin/css/icons.css" />
<link type="text/css" rel="stylesheet" href="${pagePath}/page/static/admin/css/bootstrap.css" />
<link type="text/css" rel="stylesheet" href="${pagePath}/page/static/admin/css/plugins.css" />
<link type="text/css" rel="stylesheet" href="${pagePath}/page/static/admin/css/main.css" />
</head>
<body>
	<div id="header">
		<div class="container-fluid">
			<div class="navbar">
				<div class="navbar-header">
					<a class="navbar-brand" href="${pagePath}/admin_index.do"><img alt="LOGO" src="${pagePath}/page/static/admin/images/logo.jpg" style="padding-left: 10px;"><span class="text-slogan" style="margin-top: 0px; margin-left: 10px;">校园二手交易后台</span> </a>
				</div>
				<nav class="top-nav" role="navigation">
					<ul class="nav navbar-nav pull-left">
						<li><a href="${pagePath}/admin_index.do"> <img class="user-avatar" src="${pagePath}/page/static/admin/images/admin.png" alt="head img"> ${loguser.username} [${loguser.role}]
						</a></li>
					</ul>
					<ul class="nav navbar-nav pull-right">
						<li><a href="javascript:void(0);"><i class="ec-clock"></i> <span id="time"></span></a></li>
						<li><a href="${pagePath}/index.do"><i class="im-home"></i> 网站首页</a></li>
						<li><a href="${pagePath}/logout.do"><i class="en-logout"></i> 退出登录</a></li>
					</ul>
				</nav>
			</div>
		</div>
	</div>
	<div id="sidebar">
		<div class="sidebar-inner">
			<ul id="sideNav" class="nav nav-pills nav-stacked">
				<li><a href="${pagePath}/admin_index.do">后台首页<i class="im-home"></i></a></li>
				<c:if test="${loguser.role eq '普通学生'}">
					<li><a href="${pagePath}/admin_goods_add.do">发布商品<i class="im-quill"></i></a></li>
					<li><a href="${pagePath}/admin_task_add.do">发布任务<i class="im-paragraph-left"></i></a></li>
					<li><a class="active" href="${pagePath}/admin_goods_list.do">商品管理<i class="im-stack"></i></a></li>
					<li><a href="${pagePath}/admin_task_list.do">任务管理<i class="im-stackoverflow"></i></a></li>
					<li><a href="${pagePath}/admin_order_list.do">订单管理<i class="im-stack"></i></a></li>
				</c:if>
				<c:if test="${loguser.role eq '管理员'}">
					<li><a href="${pagePath}/admin_goods_audit.do">商品审核<i class="im-checkbox-checked"></i></a></li>
					<li><a href="${pagePath}/admin_task_audit.do">任务审核<i class="im-checkmark"></i></a></li>
					<li><a href="${pagePath}/admin_user_list.do">学生管理<i class="im-users"></i></a></li>
				</c:if>
			</ul>
		</div>
	</div>
	<div id="content">
		<div class="content-wrapper">
			<div class="row">
				<div class="col-md-12 heading">
					<h1 class="page-header">
						<i class="im-stack"></i> 商品列表 <span style="color: red; font-weight: bold; font-size: 17px;">${message}</span>
					</h1>
					<div class="col-md-12">
						<div class="panel panel-default">
							<div style="height: 560px;">
								<div class="search_con fl">
									<form action="${pagePath}/admin_goods_search.do">
										<input type="text" class="input_text fl" id="goodsName" name="goodsName" placeholder="搜索商品名称" required="required"> <input type="submit" class="input_btn fr" value="搜索">
									</form>
								</div>
								<table class="table table-bordered table-hover" style="table-layout: fixed;">
									<thead>
										<tr>
											<th class="col-md-2" style="text-align: center;">商品ID</th>
											<th class="col-md-1" style="text-align: center;">商品图片</th>
											<th class="col-md-4" style="text-align: center;">商品名称</th>
											<th class="col-md-1" style="text-align: center;">类型</th>
											<th class="col-md-1" style="text-align: center;">价格</th>
											<th class="col-md-2" style="text-align: center;">状态</th>
											<th class="col-md-2" style="text-align: center;">操作</th>
										</tr>
									</thead>
									<tbody>
										<c:forEach items="${goodsList}" var="goods">
											<c:if test="${goods.status ne '已删除'}">
											<tr align="center">
												<td>${goods.id}</td>
												<td style="margin: 0px; padding: 0px;"><img alt="商品图片" src="${pagePath}${goods.picture}" width="50" height="50"></td>
												<td>${goods.name}</td>
												<td><c:forEach items="${types}" var="type">
														<c:if test="${goods.typeId eq type.id}">${type.name}</c:if>
													</c:forEach></td>
												<td>${goods.price}</td>
												<td>${goods.status}</td>
												<td>
													<a href="${pagePath}/admin_goods_modify.do?goods_id=${goods.id}" class="btn btn-info btn-sm" style="margin-right: 2px;">修改商品</a>
													<c:if test="${goods.status ne '已出售'}">
														<a href="${pagePath}/admin_goods_delete.do?goods_id=${goods.id}" class="btn btn-danger btn-sm" onclick="return confirm('确定删除此商品吗？');">删除</a>
													</c:if>
												</td>
											</tr>
											</c:if>
										</c:forEach>
										<c:if test="${empty goodsList}">
											<tr>
												<td colspan="7" align="center">没有数据</td>
											</tr>
										</c:if>
									</tbody>
								</table>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<script type="text/javascript" src="${pagePath}/page/static/admin/js/pace.min.js"></script>
	<script type="text/javascript" src="${pagePath}/page/static/admin/js/jquery.min.js"></script>
	<script type="text/javascript" src="${pagePath}/page/static/admin/js/bootstrap.js"></script>
	<script type="text/javascript" src="${pagePath}/page/static/admin/js/time.js"></script>
</body>
</html>